# Maintainer: Santiago Torres-Arias <santiago@archlinux.org>
# Contributor: kpcyrd <git@rxv.cc>

pkgname=('reprotest')
pkgver=0.7.25
pkgrel=1
pkgdesc="Run a process twice and check the output for reproducibility"
arch=('any')
license=('GPL3')
url="https://salsa.debian.org/reproducible-builds/reprotest"
depends=('python-setuptools' 'python' 'python-rstr' 'diffoscope' 'fakeroot' 'python-distro' 'python-wheel' 'libfaketime')
makedepends=('help2man' 'python-docutils' 'git')
checkdepends=('python-pytest' 'disorderfs')
optdepends=(
    'disorderfs: to enable the shuffle-dirents option'
    'python-progressbar: to show a progress bar during diffoscope')
source=("git+https://salsa.debian.org/reproducible-builds/reprotest.git?signed#tag=${pkgver}")
sha512sums=('SKIP')

validpgpkeys=("A405E58AB3725B396ED1B85C1318EFAC5FBBDBCE" # Ximin Luo
              "66AE2B4AFCCF3F52DA184D184B043FCDB9444540" # Mattia Rizzolo
              "8B7868786C33E5C64C4D0A480816B9E18C762BAD" # Mattia Rizzolo
              "F0ADA5240891831165DF98EA7CFCD8CD257721E9" # Vagrant Cascadian
              "B8BF54137B09D35CF026FE9D091AB856069AAA1C") # Holger Levsen

build() {
  cd "$srcdir/${pkgname}"
  python setup.py build

  make -C doc
}

check() {
  cd "$srcdir/${pkgname}"
  # real reprotest tests don't run in a chroot.
  PYTHONPATH=".:${PYTHONPATH}" py.test tests/test_shell.py tests/test_mdiffconf.py
}

package() {
  cd "$srcdir/${pkgname}"
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644  doc/reprotest.1 "${pkgdir}/usr/share/man/man1/reprotest.1"
}
